<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="root" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html>
<html >
<head>
<title>注册页</title>
	<meta charset="utf-8">

	<!-- 公共引用-->
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<link href="css/common.css" rel="stylesheet"  type="text/css" />

	<!-- 页面相关-->
	<link href="css/login.css" rel="stylesheet"  type="text/css" />
	<script type="text/javascript"  src="js/verification.js" ></script>
	
	<!-- layer弹出层-->
	<script src="js/layer.min.js" type="text/javascript"></script>
	<link href="css/layer.css" type="text/css" rel="stylesheet">

</head>
<body>
	<div class="login_block">
		<div class="login_head">
			<img src="images/logo.png" class="fl" width="144px;" height="70px;">
			<p class="fl">欢迎注册</p>
		</div>
		<div class="regist_body">
			<div class="regist_form">
				<div class="regist_form_head">
					<div class="enter_client border_color">企业用户</div>
					<div class="personal_client">个人用户</div>
				</div>
				<div class="regist_form_info">
						<div class="regist_element">
							<label>*&nbsp;<span id="name_type">用户账号：</span></label>
							<input id="name" name="name" placeholder="可作为登录账号使用" class="check_name_fun">
						</div>
						<div class="regist_element">
							<label>*&nbsp;登录密码：</label>
							<input  id="password" name="password" type="password" placeholder="请输入密码" plugin="passwordStrength" />
							<div class="passwordStrength"><b>密码强度:</b> <span class="password_weak">弱</span><span class="password_in">中</span><span class="password_strong">强</span></div>
						</div>
						<div class="regist_element">
							<label>*&nbsp;确认密码：</label>
							<input id="repassword" name="repassword" type="password" placeholder="请确认密码"  recheck="password" >
						</div>	
						<div class="regist_element">
							<label>*&nbsp;手机号码：</label>
							<input  id="mobile" name="mobile" placeholder="可作为登录账号使用">
						</div>				
						<div class="regist_element">
							<label>*&nbsp;短信验证：</label>
							<input id="btnCodes" name="code"  placeholder="四位验证码"  class="short_input"/>
							<img id="btnCode" src="images/validate.png"/>
							<span class="count_time"></span>
						</div>
						<div class="regist_tip">
							<input type="checkbox">
							<p>我已阅读并同意<a href="">《集成规范》</a></p>
						</div>
						<img class="regist_button regist_fun" src="images/regist_button.png" style="display:none" >
						<img class="regist_button noregist_fun" src="images/noregist_button.png" id="btnRegist">
						<div class="registed">已经注册？<a href="login.html">请登录</a></div>
				</div>
			</div>
			<div class="half_opacity regist_form" style="z-index:1"></div>
		</div>
	</div>
	<div class="regist_back"></div>

	
	<script type="text/javascript">
	// 注册事件
	$("#btnRegist").click(function(){
		$.get("${root}/regist", {code: $("#btnCodes").val()}, function(json){
			if(json.success) {
				alert("注册成功");
			} else {
				alert(json.msg);
			}
		});
	});
	
	// 发送短信验证码
	$("#btnCode").click(function(){
		// 1. 校验手机号码是否正确
		var mobile = $("#mobile").val(); // 获取手机号
		var name = $("#name").val(); // 获取用户账号名
		// 2. 用正则表达式验证
		if( /^\d{11}$/.test(mobile) ) {
			// 3. 通过校验，给这个手机发送短信, 用ajax将手机号发送给后台的java程序，让java发送短信
			$.get("${root}/regist/sms", {mobile: mobile, name: name}, function() {});
		} else {
			alert("您输入的手机号码格式不对");
		}
	});
	
	
	
	//全局变量：random.四位随机数；count.秒数；isExistence.用户名是否绑定；zhi.手机号是否被绑定;code.验证码是否正确；phonw.手机号是否一致
	//telReg:手机号验证正则
	/*var global = {random:0,count:60,isExistence:0,zhi:0,code:0,phone:""},
		telReg = /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;

	$(function(){
	
		//页面主要功能
		verification.main();

		//验证密码强度
		verification_strength.main();
	}); 
	*/
	
	</script>
</body>
</html>